package org.biliviz.be.service.impl;

import org.biliviz.be.entity.VhScoreDuration;
import org.biliviz.be.entity.VhScoreTop;
import org.biliviz.be.mapper.VhScoreDurationMapper;
import org.biliviz.be.service.VhScoreDurationService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.Comparator;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author sg
 * @since 2024-02-17
 */
@Service
public class VhScoreDurationServiceImpl extends ServiceImpl<VhScoreDurationMapper, VhScoreDuration> implements VhScoreDurationService {

    @Override
    public List<VhScoreDuration> getAll() {
        List<VhScoreDuration> vhScoreDuration = baseMapper.selectList(null);
        vhScoreDuration.sort(Comparator.comparingInt(VhScoreDuration::getTotalScore).reversed());
        return vhScoreDuration;
    }
}
